<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('客户列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>性别：</p>
                                <select name="gender">
                                    <option value="">所有</option>
                                    <option value="0">未知</option>
                                    <option value="1">男</option>
                                    <option value="2">女</option>
                                </select>
                            </li>
                            <li>
                                <p>城市：</p>
                                <input type="text" name="city"/>
                            </li>
                            <li>
                                <p>省：</p>
                                <input type="text" name="province"/>
                            </li>
                            <li>
                                <p>区县：</p>
                                <input type="text" name="conuntry"/>
                            </li>
                            <li>
                                <p>用户名：</p>
                                <input type="text" name="nickName"/>
                            </li>
                            <li>
                                <p>电话：</p>
                                <input type="text" name="phone"/>
                            </li>
                            <li class="select-time">
                                <p>加入的日期：</p>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginJoinDate]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endJoinDate]"/>
                            </li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="weixin:${classname}:edit">
					<i class="fa fa-edit"></i> 查看
				</a>
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="weixin:${classname}:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="weixin:${classname}:export">
						<i class="fa fa-download"></i> 导出
				 </a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('weixin:client:edit')}]];
        var removeFlag = [[${@permission.hasPermi('weixin:client:remove')}]];
        var prefix = ctx + "weixin/client";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "客户",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'clientId',
                    title : 'id',
                    visible: false
                },
                {
                    field : 'openId',
                    title : 'openid',
                    visible: false
                },
                {
                    field : 'unionId',
                    title : 'unionid',
                    visible: false
                },{
                    field : 'nickName',
                    title : '用户名'
                },{
                    field : 'avatarUrl',
                    title : '头像',
                        formatter: function (value, row, index) {
                            return $.table.imageView(value);
                        }
                }, {
                    field : 'gender',
                    title : '性别',
                        formatter: function (value, row, index) {
                            switch (value){
                                case "0":
                                    return "未知";
                                case "1":
                                    return "男";
                                case "2":
                                    return "女";
                                default:
                                    return "未知";
                            }
                        }
                },
                    {
                        field : 'phone',
                        title : '电话'
                    },
                    {
                        field : 'email',
                        title : '邮箱'
                    },
                    {
                        field : 'conuntry',
                        title : '国家'
                    },
                    {
                        field : 'province',
                        title : '省'
                    },
                {
                    field : 'city',
                    title : '城市'
                },
                    {
                        field : 'joinDate',
                        title : '加入的日期'
                    },
                    {
                        field : 'birthday',
                        title : '生日'
                    },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.clientId + '\')"><i class="fa fa-edit"></i>查看</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.clientId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>